ClojureScript

cljs.main: Browser script side effects don't always print

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:

Description

"src/foo/core.cljs"
(println "hello")

Sometimes this works:

$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello

and other times it doesn't:

$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...

and when it fails the browser will log

[Log] Could not send {:type :print, :content "\"hello\"", :order 8} after 10 attempts. (repl, line 3272)
[Log] Could not send {:type :print, :content "\"\\n\"", :order 9} after 10 attempts. (repl, line 3272)

making it appear that the REPL terminal is shutting down before the browser can flush its prints.

This seems very much related to CLJS-2574.

Activity

Mike Fikes made changes -
Field Original Value New Value
Description {code:title="src/foo/core.cljs"}
(println "hello")
{code}

Sometimes this works:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and other times it doesn't:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and when it fails the browser will log

{noformat}
[Log] Could not send {:type :print, :content "\"hello\"", :order 8} after 10 attempts. (repl, line 3272)
[Log] Could not send {:type :print, :content "\"\\n\"", :order 9} after 10 attempts. (repl, line 3272)
{code}

making it appear that the REPL terminal is shutting down before the browser can flush its prints.

This seems very much related to CLJS-2574.

Just a thought: Since this one might be possible to hack with a short bit of waiting on the terminal side, it might be worth doing if we find no other solution, just for the use case of running unit tests via {{cljs.main}} that are being run in the browser (so their final output doesn't get clipped).
{code:title="src/foo/core.cljs"}
(println "hello")
{code}

Sometimes this works:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and other times it doesn't:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and when it fails the browser will log

{noformat}
[Log] Could not send {:type :print, :content "\"hello\"", :order 8} after 10 attempts. (repl, line 3272)
[Log] Could not send {:type :print, :content "\"\\n\"", :order 9} after 10 attempts. (repl, line 3272)
{noformat}

making it appear that the REPL terminal is shutting down before the browser can flush its prints.

This seems very much related to CLJS-2574.

Just a thought: Since this one might be possible to hack with a short bit of waiting on the terminal side, it might be worth doing if we find no other solution, just for the use case of running unit tests via {{cljs.main}} that are being run in the browser (so their final output doesn't get clipped).
Mike Fikes made changes -
Description {code:title="src/foo/core.cljs"}
(println "hello")
{code}

Sometimes this works:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and other times it doesn't:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and when it fails the browser will log

{noformat}
[Log] Could not send {:type :print, :content "\"hello\"", :order 8} after 10 attempts. (repl, line 3272)
[Log] Could not send {:type :print, :content "\"\\n\"", :order 9} after 10 attempts. (repl, line 3272)
{noformat}

making it appear that the REPL terminal is shutting down before the browser can flush its prints.

This seems very much related to CLJS-2574.

Just a thought: Since this one might be possible to hack with a short bit of waiting on the terminal side, it might be worth doing if we find no other solution, just for the use case of running unit tests via {{cljs.main}} that are being run in the browser (so their final output doesn't get clipped).
{code:title="src/foo/core.cljs"}
(println "hello")
{code}

Sometimes this works:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and other times it doesn't:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
{noformat}

and when it fails the browser will log

{noformat}
[Log] Could not send {:type :print, :content "\"hello\"", :order 8} after 10 attempts. (repl, line 3272)
[Log] Could not send {:type :print, :content "\"\\n\"", :order 9} after 10 attempts. (repl, line 3272)
{noformat}

making it appear that the REPL terminal is shutting down before the browser can flush its prints.

This seems very much related to CLJS-2574.

Just a thought: Since this one might be possible to hack with a short bit of waiting on the terminal side, it might be worth doing if we find no other solution, just for the use case of running unit tests via {{cljs.main}} that are being run in the browser (so their final output doesn't get clipped).
Mike Fikes made changes -
Description {code:title="src/foo/core.cljs"}
(println "hello")
{code}

Sometimes this works:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and other times it doesn't:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
{noformat}

and when it fails the browser will log

{noformat}
[Log] Could not send {:type :print, :content "\"hello\"", :order 8} after 10 attempts. (repl, line 3272)
[Log] Could not send {:type :print, :content "\"\\n\"", :order 9} after 10 attempts. (repl, line 3272)
{noformat}

making it appear that the REPL terminal is shutting down before the browser can flush its prints.

This seems very much related to CLJS-2574.

Just a thought: Since this one might be possible to hack with a short bit of waiting on the terminal side, it might be worth doing if we find no other solution, just for the use case of running unit tests via {{cljs.main}} that are being run in the browser (so their final output doesn't get clipped).
{code:title="src/foo/core.cljs"}
(println "hello")
{code}

Sometimes this works:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
hello
{noformat}

and other times it doesn't:

{noformat}
$ clj -Srepro -m cljs.main src/foo/core.cljs
Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
{noformat}

and when it fails the browser will log

{noformat}
[Log] Could not send {:type :print, :content "\"hello\"", :order 8} after 10 attempts. (repl, line 3272)
[Log] Could not send {:type :print, :content "\"\\n\"", :order 9} after 10 attempts. (repl, line 3272)
{noformat}

making it appear that the REPL terminal is shutting down before the browser can flush its prints.

This seems very much related to CLJS-2574.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: