Questions about Ruby executing shell commands

Source: Internet
Author: User

Ruby executes shell commands, often "," but this is a little bit of a problem, that is, this is a new sub-process, which means that if you use the ", then the entire method can only execute the shell once, if the following also depends on the results of the execution, such as new files/folders, then, Sorry, you will find no file or directory, because the goods opened a sub-process, and then immediately down execution, he will not wait for the child process to exit and then execute, there may be a folding ear cat situation: The entire script is finished, all print exit prompt, suddenly inexplicably appear shell execution results ...

To solve this problem, need to use the system of this method, the specific use case here is too lazy to write, Baidu a search will know that the advantage of this is that he only open a child shell, the shell does not quit the words will not be executed, so that you can avoid the use of "' cause problems

Questions about Ruby executing shell commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.