我在Windows 10上。
我想使用rstudioapi向RStudio中的终端发送命令。例如:
termId <- rstudioapi::terminalCreate()
rstudioapi::terminalSend(termId, 'dir\n')我的问题是,尽管命令被发送到终端,但它不会自动运行。光标停留在行的末尾,我需要手动转到终端并按Enter。
我已经看到了许多其他终端问题,在命令的末尾有\n,所以我确信它应该能工作。
我做错了什么?
谢谢!
> sessionInfo()R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Argentina.utf8 LC_CTYPE=Spanish_Argentina.utf8 LC_MONETARY=Spanish_Argentina.utf8
[4] LC_NUMERIC=C LC_TIME=Spanish_Argentina.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstudioapi_0.13 RPostgres_1.4.4 DBI_1.1.3
loaded via a namespace (and not attached):
[1] bit_4.0.4 compiler_4.2.1 ellipsis_0.3.2 cli_3.3.0 hms_1.1.1 tools_4.2.1 Rcpp_1.0.8.3
[8] bit64_4.0.5 vctrs_0.4.1 blob_1.2.3 lifecycle_1.0.1 pkgconfig_2.0.3 rlang_1.0.3发布于 2022-07-07 21:21:56
如果有人有同样的问题:
我只是简单地用\r替换了\r,它起了作用。不要真正理解它,因为在另一台膝上型电脑上,它在\n上工作得很好。
https://stackoverflow.com/questions/72883535
复制相似问题