[
https://issues.apache.org/jira/browse/TINKERPOP-2181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16808140#comment-16808140
]
ASF GitHub Bot commented on TINKERPOP-2181:
-------------------------------------------
spmallette commented on pull request #1088: TINKERPOP-2181 Allow ctrl+c to
break a command in Gremlin Console
URL: https://github.com/apache/tinkerpop/pull/1088
https://issues.apache.org/jira/browse/TINKERPOP-2181
Pretty self-explanatory:
```text
gremlin> java.util.stream.IntStream.range(0, 10000).iterator()
==>0
==>1
==>2
==>3
==>4
...
==>348
==>349
==>350
==>351
==>352
Execution interrupted by ctrl+c
==>353
gremlin> Thread.sleep(5000)
Execution interrupted by ctrl+c
sleep interrupted
Type ':help' or ':h' for help.
Display stack trace? [yN]n
gremlin> g = TinkerGraph.open().traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.addV().as('a').addE('link').to('a')
==>e[1][0-link->0]
gremlin> g.V().repeat(out('link'))
Execution interrupted by ctrl+c
org.apache.tinkerpop.gremlin.process.traversal.util.TraversalInterruptedException
Type ':help' or ':h' for help.
Display stack trace? [yN]n
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured localhost/127.0.0.1:8182
gremlin> :> g.addV().as('a').addE('link').to('a')
==>e[1][0-link->0]
gremlin> :> g.V().repeat(out('link'))
Execution interrupted by ctrl+c
org.apache.tinkerpop.gremlin.jsr223.console.RemoteException
Type ':help' or ':h' for help.
Display stack trace? [yN]n
gremlin> :remote console
==>All scripts will now be sent to Gremlin Server -
[localhost/127.0.0.1:8182] - type ':remote console' to return to local mode
gremlin> g.V().repeat(out('link'))
Execution interrupted by ctrl+c
org.apache.tinkerpop.gremlin.jsr223.console.RemoteException
Type ':help' or ':h' for help.
Display stack trace? [yN]n
```
Right now it will only interrupt things that respect an actual interruption
so while all of the above works nicely, something like `while(true){}` will
not. This issue appears fixable on 3.4.x but not 3.3.x given some changes to
groovysh in the 2.5.x line which is not available for 3.3.x and still on 2.4.x.
Backporting those changes and/or working around not having those changes is
pretty ugly unfortunately. Still considering what to do, but I thought I'd
issue the PR so folks could play with it if they like.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Allow ctrl+c to break out of a long running process in Gremlin Console
> ----------------------------------------------------------------------
>
> Key: TINKERPOP-2181
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2181
> Project: TinkerPop
> Issue Type: Improvement
> Components: console
> Affects Versions: 3.3.5
> Reporter: stephen mallette
> Assignee: stephen mallette
> Priority: Major
>
> We've long wanted this one - you screw up and hit enter on {{g.V()}} on a
> billion vertex graph. Only thing you can do to stop it is kill the console.
> Intercept {{ctril+c}} and translate that to an interrupt of the main thread.
> If the main thread is doing something that respects a call to
> {{Thread.interrupt()}} then the process will stop and return control to the
> user.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)