https://bugs.kde.org/show_bug.cgi?id=490961
Bug ID: 490961 Summary: Command line arguments are incorrect Classification: Applications Product: rkward Version: unspecified Platform: Other OS: All Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: rkward-de...@kde.org Reporter: ikwsi...@gmail.com Target Milestone: --- SUMMARY The command line arguments set via `Rf_initialize_R` and `R_set_command_line_arguments` are incorrect. The first argument must be the name of the program by which R was invoked. R assumes that the previous is true, and so it skips the first command line argument. for Unix, in `Rf_initialize_R`: https://github.com/wch/r-source/blob/f4de6dfdeb1d8b100d6a70c259c80a20508a4309/src/unix/system.c#L407 for Windows, in `cmdlineoptions`: https://github.com/wch/r-source/blob/589b76ba28bb97e9d628f6e4ae1735c4e2660b3f/src/gnuwin32/system.c#L1180 for all, in `R_common_command_line`: https://github.com/wch/r-source/blob/f4de6dfdeb1d8b100d6a70c259c80a20508a4309/src/main/CommandLineArgs.c#L103 I would suggest something more like: ``` int argc = 4; char* argv[4] = { qstrdup ("rkward"), qstrdup ("--slave"), qstrdup ("--no-save"), qstrdup ("--no-restore") }; ``` But I have one more suggestion. I think you should not be using option `--slave`. In interactive use, this turns off printing the prompt when waiting for input and turns off printing a continuation prompt for code that spans multiple lines. That doesn't seem like what you want. Instead, you should replace it with `--quiet` (or `--silent` or `-q`, but I prefer `--quiet`). When combined with `--no-save`, you end up with the same R settings except `R_NoEcho` is `FALSE`, as it should be: ``` int argc = 4; char* argv[4] = { qstrdup ("rkward"), qstrdup ("--quiet"), qstrdup ("--no-save"), qstrdup ("--no-restore") }; ``` OBSERVED RESULT ```R > commandArgs() [1] "--slave" [2] "--no-save" [3] "--no-restore" ``` EXPECTED RESULT ```R > commandArgs() [1] "rkward" [2] "--quiet" [3] "--no-save" [4] "--no-restore" ``` -- You are receiving this mail because: You are watching all bug changes.