> /Applications/MAMP/htdocs/sass/sass_watch.ok 2>> /Applications/MAMP/htdocs/sass/sass_watch.notok & function LaunchBackgroundProcess($command) { // thanks to https://stackoverflow.com/questions/45953/php-execute-a-background-process global $incssfiles, $outcssfiles, $logfiles, $errlogfiles,$amrunning,$sasexe; // Run command Asynchroniously (in a separate thread) if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { // Windows $command = 'start "" '. $command; } else { // Linux/UNIX $command = $command .' /dev/null &'; } $handle = popen($command, 'r'); if ($handle !== false) { pclose($handle); return true; } else { return false; } } //Note for windows users: //You cannot redirect stdout/stderr to nul in the following manner: //startBackgroundProcess('ping yandex.com', null, 'nul', 'nul'); //However, you can do this: //startBackgroundProcess('ping yandex.com >nul 2>&1'); function startBackgroundProcess( $command, $stdin = null, $redirectStdout = null, $redirectStderr = null, $cwd = null, $env = null, $other_options = null ) { // thanks to https://stackoverflow.com/questions/45953/php-execute-a-background-process global $incssfiles, $outcssfiles, $logfiles, $errlogfiles,$amrunning,$sasexe; $descriptorspec = array( 1 => is_string($redirectStdout) ? array('file', $redirectStdout, 'w') : array('pipe', 'w'), 2 => is_string($redirectStderr) ? array('file', $redirectStderr, 'w') : array('pipe', 'w'), ); if (is_string($stdin)) { $descriptorspec[0] = array('pipe', 'r'); } $proc = proc_open($command, $descriptorspec, $pipes, $cwd, $env, $other_options); if (!is_resource($proc)) { throw new \Exception("Failed to start background process by command: $command"); } if (is_string($stdin)) { fwrite($pipes[0], $stdin); fclose($pipes[0]); } if (!is_string($redirectStdout)) { fclose($pipes[1]); } if (!is_string($redirectStderr)) { fclose($pipes[2]); } return $proc; } if (!function_exists("readline")) { // thanks to https://stackoverflow.com/questions/23238378/call-to-undefined-function-readline function readline($prompt = null){ if ($prompt){ echo $prompt; } $fp = fopen("php://stdin","r"); $line = rtrim(fgets($fp, 1024)); return $line; } } if (!isset($argc)) { if (isset($_GET['check'])) { } else if (isset($_GET['in1']) && isset($_GET['out1'])) { } else if (isset($_POST['in1out1'])) { $one=1; while (isset($_POST['in' . $one . 'out' . $one])) { if (sizeof($incssfiles) > $one) { if (PHP_OS=='WINNT' || PHP_OS=='WIN32' || PHP_OS=='Windows') { if (1 == 2) { startBackgroundProcess('ping yandex.com >nul 2>&1'); } } else { if (1 == 2) { startBackgroundProcess('ping yandex.com >> /dev/null 2>> /dev/null'); } } } $one++; } } else { echo "

Sass 'sass --watch [inputSassSCSS] [outputCSS]' Supervisor and Watchdog

RJM Programming

September, 2019







"; } } else { } ?>