0

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.