Run terminal command on project startup

I have a project that I need to run a few startup tasks after loading. I found how to automate my gulp watch in startup tasks. But I also want to run a simple terminal command. How do I do that?

 

Let's say I want a terminal window to run "php artisan serve" when opening the project. How can I put that in startup tasks?

3 comments
Comment actions Permalink

Hi there,

You may try doing this using External Tools.

You can attach specific External Tools entry as "Before Launch" task for your Gulp task which you are using in Startup Tasks

1
Comment actions Permalink

Another possible approach: just add such command as separate Gulp task, something like:

gulp.task('artisan:serve', (cb) => {
  childProcessExec('php artisan serve', (err) => {
    cb(err);
  });
});

 

0
Comment actions Permalink

A Google search brought me here, I was looking for a similar. The "Before Launch" suggestion works, however it doesn't pass the proper parameters to the external tool. In my case that's Hyper, a terminal emulator, and I want it to open in the project's root directory.

Here's the configuration for the tool. It works as expected if I launch it manually, but if I use it in the "Before Launch" for a Startup task, it opens in my user home directory.

Any suggestions? Thanks in advance.

0

Please sign in to leave a comment.