-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcat_output.R
41 lines (30 loc) · 986 Bytes
/
cat_output.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Writes this line to stderr
# cat: /proc/cpuinfo: No such file or directory
# So we want to grab this line
# Still goes to stderr
#capture.output(
# parallel::detectCores(all.tests = TRUE, logical = FALSE)
# , file = stdout(), type = "message"
#)
# Still goes to stderr
#capture.output(
# parallel::detectCores(all.tests = TRUE, logical = FALSE)
# , file = stdout(), type = "output"
#)
# Still goes to stderr
#sink(file = stdout(), type = "message")
#parallel::detectCores(all.tests = TRUE, logical = FALSE)
#sink(file = NULL, type = "message")
# Nope
#sink(file = stdout(), type = "output")
#parallel::detectCores(all.tests = TRUE, logical = FALSE)
#sink(file = NULL, type = "output")
# Maybe since it's coming from a system command something weirder is
# happening
# Still goes to stderr
capture.output(
system2("cat", "nonexistent.file")
, file = stdout(), type = "message"
)
parallel::detectCores(logical = FALSE)
write("prints to stderr", stderr())