[OpenSmalltalk/opensmalltalk-vm] Add --quiet option to allow an app to own stdout and stderr (#395)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[OpenSmalltalk/opensmalltalk-vm] Add --quiet option to allow an app to own stdout and stderr (#395)

Eliot Miranda-4
 

I envison to have --quiet and --debugoutput FILENAME as options in the future. For an end-user it is difficult to separate application output/error from VM one (e.g. the infamous thread priority warning).


You can view, comment on, or merge this pull request online at:

  https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395

Commit Summary

  • debug: Prepare to let the app own stderr
  • debug: Introduce the --quiet VM option to keep things silent

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add --quiet option to allow an app to own stdout and stderr (#395)

Eliot Miranda-4
 

@bencoman commented on this pull request.


In platforms/unix/vm/sqUnixMain.c:

> @@ -863,13 +863,13 @@ sqInt  primitivePluginRequestState(void)	{ return dpy->primitivePluginRequestSta
 
 static void outOfMemory(void)
 {
-  /* pushing stderr outputs the error report on stderr instead of stdout */
+  /* pushing VM_ERR() outputs the error report on VM_ERR() instead of stdout */

What is the significance of changing this comment? (I'm not familiar with pushOutputFile)


In platforms/unix/vm/sqUnixMain.c:

>    pushOutputFile((char *)STDERR_FILENO);
   error("out of memory\n");
 }
 
 /* Print an error message, possibly a stack trace, do /not/ exit.
- * Allows e.g. writing to a log file and stderr.
+ * Allows e.g. writing to a log file and VM_ERR().

Same again. Search/replaced within comment useful?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395?email_source=notifications\u0026email_token=AIJPEW4U2F2NJITIQ63MWMDPVQGYTA5CNFSM4HKXXHEKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBYWONUA#pullrequestreview-237823696", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395?email_source=notifications\u0026email_token=AIJPEW4U2F2NJITIQ63MWMDPVQGYTA5CNFSM4HKXXHEKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOBYWONUA#pullrequestreview-237823696", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add --quiet option to allow an app to own stdout and stderr (#395)

Eliot Miranda-4
In reply to this post by Eliot Miranda-4
 

An expansive scattering of changes, but pretty much all of them are...
simply refactoring fprintf(stderr, ==> fprintf(VM_ERR(),
excepting the following which looks fine...

static FILE *VM_ERR_FILE = NULL;

FILE *VM_ERR(void)
{
	if (!VM_ERR_FILE) {
		VM_ERR_FILE = stderr;
	}
	return VM_ERR_FILE;
}

void sqSetVmErrFile(FILE *file)
{
	VM_ERR_FILE = file;
}



static int vm_parseArgument(int argc, char **argv)
{
   ...
   else if (!strcmp(argv[0], VMOPTION("quiet"))) {
       sqSetVmErrFile(fopen("/dev/null", "w"));
       return 1;
    }
    return 0; /* option not recognised */
}

(void) printUsage {
        ...
	printf("  "VMOPTION("quiet")"                don't print debugging messages from the VM\n");
        ...
}

        

And the following seems correct to align with sq.h...

- extern void addIdleUsecs(long idleUsecs);
+ extern void addIdleUsecs(sqInt idleUsecs);

https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/83aebb122ca2fd32a86ef8b7d478ed32b12dc6b1/platforms/Cross/vm/sq.h#L180


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395?email_source=notifications\u0026email_token=AIJPEW7MAOBSGEALOKDWVDTPVQHA7A5CNFSM4HKXXHEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVOV7TQ#issuecomment-492658638", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395?email_source=notifications\u0026email_token=AIJPEW7MAOBSGEALOKDWVDTPVQHA7A5CNFSM4HKXXHEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVOV7TQ#issuecomment-492658638", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add --quiet option to allow an app to own stdout and stderr (#395)

Eliot Miranda-4
In reply to this post by Eliot Miranda-4
 

Hi Holger,

I don't object to this in principle.  But I question whether it is necessary, except on Windows.  Let me ask you why using the shell to redirect stderr to /dev/null is inadequate.  I would simply do

bin/squeak my image.image 2>/dev/null &

Where does this not work?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395?email_source=notifications\u0026email_token=AIJPEW3WPN3FGDX3VBBT7KLP4OZ2BA5CNFSM4HKXXHEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYUOOIY#issuecomment-505997091", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395?email_source=notifications\u0026email_token=AIJPEW3WPN3FGDX3VBBT7KLP4OZ2BA5CNFSM4HKXXHEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYUOOIY#issuecomment-505997091", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>
Reply | Threaded
Open this post in threaded view
|

Re: [OpenSmalltalk/opensmalltalk-vm] Add --quiet option to allow an app to own stdout and stderr (#395)

Eliot Miranda-4
In reply to this post by Eliot Miranda-4
 

It takes the ability from an application author to use stderr. I look at it from the point of view of using the "ecstatic" cli application (pillar to html) and the scheduler param warning printed by the VM really takes away from the quality/usefulness of the app (I have neither seen this with python, ruby, java, libstdc++ runtimes).

There are probably more elegant ways to achieve this but wanted to get a discussion started.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

<script type="application/ld+json">[ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395?email_source=notifications\u0026email_token=AIJPEW7RL22TTIDPKO4YRX3P6RPXPA5CNFSM4HKXXHEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZPZQFY#issuecomment-509581335", "url": "https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/395?email_source=notifications\u0026email_token=AIJPEW7RL22TTIDPKO4YRX3P6RPXPA5CNFSM4HKXXHEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZPZQFY#issuecomment-509581335", "name": "View Pull Request" }, "description": "View this Pull Request on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]</script>