Redirect output to file fails
See original GitHub issueWhen executing the following command directly on the cmd line the database is dumped to the file correctly.
When running the same command via .exec.
using Grunt.js (see below) the output is in the console and the file is created but has no contents.
shell.exec('mysqldump -u my_user -pmy_pass test > test.sql');
My ultimate goal is to run a dump via ssh like so:
shell.exec("ssh user@host \ mysqldump -u my_user -pmy_pass test > test.sql");
Issue Analytics
- State:
- Created 10 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Redirection of stdout to a file not working - Stack Overflow
You have sent stdout to the file, but your program is reporting errors which go to stderr. To setup redirection of stderr, use...
Read more >Linux Redirect Error Output To File - nixCraft
Linux Redirect Error Output To File ; Syntax To redirect all output to file. The syntax is as follows to redirect output (stdout)...
Read more >How to redirect stderr to a file [duplicate] - Ask Ubuntu
Redirect stdout to one file and stderr to another file: command > out 2>error · Redirect stdout to a file ( >out ),...
Read more >Modify 2>&1 so that output goes to a specific file and any ...
Yes, this is possible. The 2>&1 means the following: 2 : stderr > : output redirect & : copy file descriptor 1 :...
Read more >Redirect output of a program to a file fails - Unix StackExchange
I am attempting to redirect its terminal output to a file using the following command. foo > ./someFile.txt. Now when I run that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I found this: #154
shell.exec('command').output.to('path/to/file');
worked for me.
I’m going to close this issue, since it doesn’t seem like it’s related to ShellJS. Please re-open if the issue persists.