Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cannot redirect the I/O streams from r_bg(). #43

Closed
wlandau opened this issue Mar 3, 2018 · 2 comments
Closed

I cannot redirect the I/O streams from r_bg(). #43

wlandau opened this issue Mar 3, 2018 · 2 comments

Comments

@wlandau
Copy link

wlandau commented Mar 3, 2018

# The error message is cryptic.
callr::r_bg(func = function() 1 + "A", stdout = "~/out.txt", stderr = "~/err.txt")
#> Error in process_initialize(self, private, command, args, stdout, stderr, : callr error
# No traceback or warnings are available to the master process.
traceback()
#> No traceback available
warnings()
#> NULL
# Neither I/O stream made it to a text file.
any(c("out.txt", "err.txt") %in% list.files("~"))
#> [1] FALSE
# Using development callr: 3d398568995e5769eb9cab844ca735662e009485
sessionInfo()
#> R version 3.4.3 (2017-11-30)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: KDE neon User Edition 5.12
#> 
#> Matrix products: default
#> BLAS: /usr/lib/libblas/libblas.so.3.6.0
#> LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_0.12.15     crayon_1.3.4     digest_0.6.15    rprojroot_1.3-2 
#>  [5] assertthat_0.2.0 R6_2.2.2         backports_1.1.2  formatR_1.5     
#>  [9] magrittr_1.5     evaluate_0.10.1  debugme_1.1.0    stringi_1.1.6   
#> [13] callr_2.0.2.9001 rmarkdown_1.8    tools_3.4.3      stringr_1.3.0   
#> [17] yaml_2.1.16      compiler_3.4.3   htmltools_0.3.6  knitr_1.20
@gaborcsardi
Copy link
Member

~ is not expanded, you need to use path.expand() manually.

@wlandau
Copy link
Author

wlandau commented Mar 4, 2018

Thanks @gaborcsardi, it worked.

callr::r_bg(
  func = function() 1 + "A",
  stdout = path.expand("~/out.txt"),
  stderr = path.expand("~/err.txt")
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants