Reputation: 538
I am trying to find a solution to run unix shell commands in CasperJS in synchronous mode.
I have seen exec-sync for node.js, but could never make it work for casper:
Sync-exec: http://davidwalsh.name/sync-exec
I intend to run some unix utilities through casperjs:
sed -e "1,1000d" file1 > file2 -> To copy the first 1000 lines from file1 to file2
wc -l filename -> To calculate the lines
Maybe someone has experience with this.
Upvotes: 0
Views: 1953
Reputation: 538
I have resolved the issue in the following way, just in case someone requires it:
Running unix commands as per example:
https://github.com/ariya/phantomjs/blob/master/examples/child_process-examples.js
As far as synchronization is concerned, I have wrapped the command execution under:
casper.then(function() {
});
and achieved synchronized execution this way.
Upvotes: 2