After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 707233 - [Genie] Allow exit status to be set from init function
[Genie] Allow exit status to be set from init function
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Genie
0.18.x
Other Linux
: Normal enhancement
: ---
Assigned To: Jamie McCracken
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-01 17:02 UTC by Al Thomas
Modified: 2018-05-22 14:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow the main function, init, to return an integer as the program exit status (2.11 KB, patch)
2017-03-22 20:45 UTC, Al Thomas
none Details | Review

Description Al Thomas 2013-09-01 17:02:16 UTC
Currently an exit status of zero is always returned by a Genie program. To indicate a program has failed in some way a non-zero exit code would be useful, for example when using a Genie program from a Unix script.

At present init is a void function, so:

init 
  return 1

gives "error: Return with value in void function"

The proposal is to make init return an integer, but for the parser to default to a value of zero if no return statement is provided. This maintains backwards compatibility.
Comment 1 Jamie McCracken 2013-09-08 21:22:17 UTC
Yes good idea
Comment 2 Al Thomas 2017-03-22 20:45:19 UTC
Created attachment 348532 [details] [review]
Allow the main function, init, to return an integer as the program exit status

This patch keeps the original init block:

init
	pass

but, alternatively allows an integer to be returned:

init:int
	return 0

The integer is the exit status for the program. This allows Genie programs to be used more easily from scripts, which then know whether the Genie program was successful or not. Convention is that zero indicates a successful program. For
example see bash:
http://tldp.org/LDP/abs/html/exitcodes.html
Comment 3 GNOME Infrastructure Team 2018-05-22 14:56:02 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/402.