Method main()


Method main

int|string|Concurrent.Future main(int argc, array(string) argv)
int|string|Concurrent.Future main(array(string) argv)
__async__ int|string main(int argc, array(string) argv)
__async__ int|string main(array(string) argv)

Description

Main program entry point.

Parameter argc

The number of elements in argv.

Parameter argv

The arguments passed to the pike binary excluding arguments intended for the master, but including the name of the main program script.

Note

This function is provided by the user.

Returns

Returns one of:

int(0)

Program completed successfully.

int(1..127)

Progam failed with the specified exit code.

int(..-1)

Enter backend mode. The program will complete when exit() or _exit() is called.

string(8bit)

Program completed successfully with diagnostic on Stdio.stdout.

Concurrent.Future

Enter backend mode. The program will exit with code 10 and an error message on Stdio.stderr if the future fails. Otherwise the success value of the future will be handled as the return value of main() recursively.

Note

Support for omitting argc was added to the master in Pike 8.0.0.

Note

Support for return of Concurrent.Futures was added in Pike 9.0.4.

See also

MasterObject()->_main()