Start piping data

@return null
546876
public function start()
    {
        // $offset = 0;
        // //Go to where we were when we ended the last batch
        // fseek($fileHandle, $offset);
        // fgetcsv($fileHandle)
        // $offset = ftell($fileHandle);
            
        $data = array();
        if (($handle = fopen($this->filePath, "r")) !== false) {
            $row = fgetcsv($handle, 0, $this->fieldSeparator);
            //Convert to UTF8 if assign charset to utf8
            $row = array_map(
                function ($item) {
                    return ($this->charset=="utf8" && is_string($item))
                        ?utf8_encode($item):$item;
                },
                $row
            );

            if (is_array($row)) {
                if (!$this->firstRowData) {
                    $columnNames = $row;
                } else {
                    $columnNames = array();
                    for ($i = 0; $i < count($row); $i++) {
                        array_push($columnNames, 'Column ' . $i);
                    }

                }

                $metaData = array("columns" => array());
                for ($i = 0; $i < count($columnNames); $i++) {
                    $metaData["columns"][$columnNames[$i]] = array(
                            "type" => (isset($row))
                                ?$this->guessType($row[$i]) : "unknown"
                        );
                }
                $this->sendMeta($metaData, $this);
                $this->startInput(null);

                if ($this->firstRowData) {
                    $this->next(array_combine($columnNames, $row), $this);
                }
            }
            while (($row = fgetcsv($handle, 0, $this->fieldSeparator)) !== false) {
                $row = array_map(
                    function ($item) {
                        return ($this->charset=="utf8" && is_string($item))
                            ?utf8_encode($item):$item;
                    },
                    $row
                );    
                $this->next(array_combine($columnNames, $row), $this);
            }
        } else {
            throw new \Exception('Failed to open ' . $this->filePath);
        }
        $this->endInput(null);
    }
1068065
public function start()
    {
        if ($this->isRunning()) {
            throw new LogicException('Process is already running');
        }

        $this->reset();

        $cmd = $this->cmd;
        if (substr($cmd, 0, 4) == 'php ') {
            $php = PHP_BINARY ?: PHP_BINDIR . '/php';
            $cmd = $php . substr($cmd, 3);
        }

        $descriptorspec = [
            0 => ['pipe', 'r'], // STDIN
            1 => ['pipe', 'w'], // STDOUT
            2 => ['pipe', 'w']  // STDERR
        ];

        $options = [
            'suppress_errors' => true,
            'binary_pipes'    => true,
        ];

        $this->process = proc_open($cmd, $descriptorspec, $this->pipes, base_path(), $this->env, $options);

        if (!is_resource($this->process)) {
            throw new RuntimeException('Unable to launch a new process.');
        }
    }
205397
public function Start()
    {
        if(!file_exists($this->definitions_path))
        {
            throw new \Exception(
                t("Trying to import symbols from a non existent directory.")
            );
        }
        
        $this->SendMessage(
            sprintf(
                t("Starting import of definitions stored in %s format."),
                $this->import_type
            )
        );
        
        if($this->import_type == Type::JSON)
        {
            $this->LoadFromJSON($this->definitions_path);
        }
        else
        {
            $this->LoadFromPHP($this->definitions_path);
        }
        
        $this->SendMessage(t("Import completed."));
    }
275353
public function start()
    {
        $__scope = $this->_runHooks($this->_startHooks);
        extract($__scope);
        
        $this->_write($this->_socket, self::READY);
        
        /* Note the naming of the local variables due to shared scope with the user here */
        for (;;) {
            declare (ticks = 1);
            // don't exit on ctrl-c
            pcntl_signal(SIGINT, SIG_IGN, true);
            
            $this->_cancelled = false;
            
            $__input = $this->_transform($this->_read($this->_socket));
            
            if ($__input === null) {
                continue;
            }
            
            $__response = self::DONE;
            
            $this->_ppid = posix_getpid();
            $this->_pid  = pcntl_fork();
            
            if ($this->_pid < 0) {
                throw new \RuntimeException('Failed to fork child labourer');
            } elseif ($this->_pid > 0) {
                // kill the child on ctrl-c
                pcntl_signal(SIGINT, array(
                    $this,
                    'cancelOperation'
                ), true);
                pcntl_waitpid($this->_pid, $__status);
                
                if (!$this->_cancelled && $__status != (self::ABNORMAL_EXIT << 8)) {
                    $__response = self::EXITED;
                } else {
                    $this->_runHooks($this->_failureHooks);
                    $__response = self::FAILED;
                }
            } else {
                // if the user has installed a custom exception handler, install a new
                // one which calls it and then (if the custom handler didn't already exit)
                // exits with the correct status.
                // If not, leave the exception handler unset; we'll display
                // an uncaught exception error and carry on.
                $__oldexh = set_exception_handler(array(
                    $this,
                    'delegateExceptionHandler'
                ));
                if ($__oldexh && !$this->_userExceptionHandler) {
                    $this->_userExceptionHandler = $__oldexh; // save the old handler (once)
                } else {
                    restore_exception_handler();
                }
                
                // undo ctrl-c signal handling ready for user code execution
                pcntl_signal(SIGINT, SIG_DFL, true);
                $__pid = posix_getpid();
                
                $__result = eval($__input);
                
                if (posix_getpid() != $__pid) {
                    // whatever the user entered caused a forked child
                    // (totally valid, but we don't want that child to loop and wait for input)
                    exit(0);
                }
                
                if (preg_match('/\s*return\b/i', $__input)) {
                    fwrite(STDOUT, sprintf("%s\n", $this->_inspector->inspect($__result)));
                }
                $this->_expungeOldWorker();
            }
            
            $this->_write($this->_socket, $__response);
            
            if ($__response == self::EXITED) {
                exit(0);
            }
        }
    }
640258
public function main()
	{
		ob_start();
		$exectimeStart = microtime( true );

		if( ( $result = $this->checkEnvironment() ) !== null ) {
			return $result;
		}

		try
		{
			\Aimeos\Aimeos\Setup::execute();
			$output = ob_get_contents();
		}
		catch( Exception $e )
		{
			$output = ob_get_contents();
			$output .= PHP_EOL . $e->getMessage();
			$output .= PHP_EOL . $e->getTraceAsString();
		}

		ob_end_clean();


		return '<pre>' . $output . '</pre>' . PHP_EOL .
			sprintf( "Setup process lasted %1\$f sec</br>\n", (microtime( true ) - $exectimeStart) );
	}
1018507
private function start()
    {
        $name = $this->scaffoldCommandObj->getObjName('Name');
        $path = $this->getPath($name, 'model');

        $this->createBaseModelIfNotExists();

        if ($this->files->exists($path))
        {
            return $this->scaffoldCommandObj->comment("x $path");
        }

        $this->files->put($path, $this->compileModelStub());

        $this->scaffoldCommandObj->info('+ ' . $path);
    }
451146
public static function Start()
	{
		// Retrieve the global variables
		if(!$argv) $argv = $_SERVER["argv"];

		// Get the console variables
		$functionName = $argv[1];
		$rows = explode(",", $argv[2]);
		$vars = array();
		foreach($rows as $row)
		{
			$parts = explode("=", $row);
			$vars[$parts[0]] = $parts[1];
		}

		// Prepare the console
		$console = new Console;

		// Run the console
		try
		{
			return $console->Run($functionName, $vars);
		}
		catch(\Exception $ex)
		{
			return "\nError: " . $ex->getMessage() . "\n";
		}
	}
1052776
public function onStart()
    {
        $this->setProcessName('master process');
        $this->createPidFile();

        $this->container->event->trigger('swoole.start', func_get_args());
    }
1021932
protected function onInit()
    {
        // $this->connection = Util::get($this->params,"connection",null);
        $connectionString = Util::get($this->params, "connectionString", "");
        $username = Util::get($this->params, "username", "");
        $password = Util::get($this->params, "password", "");
        $charset = Util::get($this->params, "charset");
        
        $key = md5($connectionString.$username.$password);
        if (PdoDataSource::$connections==null) {
            PdoDataSource::$connections = array();
        }
        if (isset(PdoDataSource::$connections[$key])) {
            $this->connection = PdoDataSource::$connections[$key];
        } else {
            $this->connection = new PDO($connectionString, $username, $password);
            PdoDataSource::$connections[$key] = $this->connection;
        }
        if ($charset) {
            $this->connection->exec("set names '$charset'");
        }
    }
639257
protected function start()
    {
        if ($this->isRunning($this->getCurrentPid())) {
            $this->error('Failed! swoole_http_server process is already running.');

            return;
        }

        $host = Arr::get($this->config, 'server.host');
        $port = Arr::get($this->config, 'server.port');
        $hotReloadEnabled = Arr::get($this->config, 'hot_reload.enabled');
        $accessLogEnabled = Arr::get($this->config, 'server.access_log');

        $this->info('Starting swoole http server...');
        $this->info("Swoole http server started: <http://{$host}:{$port}>");
        if ($this->isDaemon()) {
            $this->info(
                '> (You can run this command to ensure the ' .
                'swoole_http_server process is running: ps aux|grep "swoole")'
            );
        }

        $manager = $this->laravel->make(Manager::class);
        $server = $this->laravel->make(Server::class);

        if ($accessLogEnabled) {
            $this->registerAccessLog();
        }

        if ($hotReloadEnabled) {
            $manager->addProcess($this->getHotReloadProcess($server));
        }

        $manager->run();
    }
1146578
function start()
	{
		$originalProps = $this->props;		
		$response = new ET_PerformExtract($this->authStub, $this->props);
		//print_r($response);
		return $response;
	}
1283054
public function start()
    {
        if (!$this->isIPC) {
            throw new Exception('Fatal error, unable to create SHM segments for process communications');
        }

        pcntl_signal(SIGCHLD, SIG_IGN);

        $pid = pcntl_fork();
        if ($pid === 0) {
            $this->isChild = true;
            sleep(1);

            pcntl_signal(SIGUSR1, [$this, 'sigHandler']);

            if ($this->guid !== 0) {
                posix_setgid($this->guid);
            }
            if ($this->puid !== 0) {
                posix_setuid($this->puid);
            }
            $this->run();

            exit(0);
        } else {
            $this->isChild = false;
            $this->running = true;
            $this->pid = $pid;
        }
    }
411875
public function start() {
        foreach ($this->modules as $module) {
            $module->start();
        }

        if (php_sapi_name() == "cli") {
            Commands::handleCommand();
        }
        else {
            Routes::handleRequest();
        }
    }
1119601
protected function onInit()
    {
        $host = Util::get($this->params, "host", "");//host\instanceName
        $username = Util::get($this->params, "username", "");
        $password = Util::get($this->params, "password", "");
        $dbname = Util::get($this->params, "dbname", "");
        $connString = "host=$host dbname=$dbname user=$username password=$password";
        
        $key = md5($connString);

        if (isset(PostgreSQLDataSource::$connections[$key])) {
            $this->connection = PostgreSQLDataSource::$connections[$key];
        } else {
            $conn = pg_connect($connString);
            if ($conn) {
                $this->connection = $conn;
            } else {
                throw new \Exception("Could not connect to database");
            }
            PostgreSQLDataSource::$connections[$key] = $this->connection;
        }
        
    }
1335536
public function start()
    {
        if ($this->isStart) {
            return;
        }

        $this->startAt = time();
        $this->stopAt  = null;
        $this->isStart = true;

        if (extension_loaded('xdebug')) {
            xdebug_disable();
        }

        foreach ($this->onStart as $callable) {
            call_user_func_array($callable, []);
        }

        while ($this->isStart) {
            $this->tick();
        }

        $this->stopAt = time();

        foreach ($this->onStop as $callable) {
            call_user_func_array($callable, []);
        }

        if (extension_loaded('xdebug')) {
            xdebug_enable();
        }
    }
1130279
public function start()
    {
        if (0 !== $this->oid) {
            throw new StatusError('The context has already been started.');
        }

        list($parent, $child) = Stream\pair();

        switch ($pid = pcntl_fork()) {
            case -1: // Failure
                throw new ForkException('Could not fork process!');

            case 0: // Child
                // @codeCoverageIgnoreStart

                // Create a new event loop in the fork.
                Loop\loop($loop = Loop\create(false));

                $channel = new ChannelledStream($pipe = new DuplexPipe($parent));
                fclose($child);

                $coroutine = new Coroutine($this->execute($channel));
                $coroutine->done();

                try {
                    $loop->run();
                    $code = 0;
                } catch (\Throwable $exception) {
                    $code = 1;
                }

                $pipe->close();

                exit($code);

                // @codeCoverageIgnoreEnd

            default: // Parent
                $this->pid = $pid;
                $this->oid = posix_getpid();
                $this->channel = new ChannelledStream($this->pipe = new DuplexPipe($child));
                fclose($parent);
        }
    }
1047688
public static function startup()
    {
        global $PPHP;

        trigger('language', self::$_req['lang']);

        if (isset(self::$_PATH[1]) && listeners('route/' . self::$_PATH[0] . '+' . self::$_PATH[1])) {
            self::$_base = array_shift(self::$_PATH) . '+' . array_shift(self::$_PATH);
        } elseif (isset(self::$_PATH[0])) {
            if (listeners('route/' . self::$_PATH[0])) {
                self::$_base = array_shift(self::$_PATH);
            } else {
                trigger('http_status', 404);
            };
        } elseif (listeners('route/main')) {
            self::$_base = 'main';
        } else {
            trigger('http_status', 404);
        };
        self::$_req['path_args'] = self::$_PATH;
    }