summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/runner.py19
-rw-r--r--ranger/help/starting.py1
2 files changed, 19 insertions, 1 deletions
diff --git a/ranger/core/runner.py b/ranger/core/runner.py
index 26424881..f35f99b7 100644
--- a/ranger/core/runner.py
+++ b/ranger/core/runner.py
@@ -37,10 +37,21 @@ from subprocess import Popen, PIPE
 from ranger.ext.waitpid_no_intr import waitpid_no_intr
 
 
-ALLOWED_FLAGS = 'sdpSDP'
+ALLOWED_FLAGS = 'sdpwSDPW'
 devnull = open(os.devnull, 'a')
 
 
+def press_enter():
+	"""Wait for an ENTER-press"""
+	sys.stdout.write("Press ENTER to continue")
+	try:
+		waitfnc = raw_input
+	except NameError:
+		# "raw_input" not available in python3
+		waitfnc = input
+	waitfnc()
+
+
 class Context(object):
 	"""
 	A context object contains data on how to run a process.
@@ -144,6 +155,7 @@ class Runner(object):
 
 		toggle_ui = True
 		pipe_output = False
+		wait_for_enter = False
 
 		popen_kws['args'] = action
 		if 'shell' not in popen_kws:
@@ -168,6 +180,9 @@ class Runner(object):
 		if 'd' in context.flags:
 			toggle_ui = False
 			context.wait = False
+		if 'w' in context.flags:
+			if not pipe_output and context.wait: # <-- sanity check
+				wait_for_enter = True
 
 		# Finally, run it
 
@@ -182,6 +197,8 @@ class Runner(object):
 			else:
 				if context.wait:
 					waitpid_no_intr(process.pid)
+				if wait_for_enter:
+					press_enter()
 		finally:
 			if toggle_ui:
 				self._activate_ui(True)
diff --git a/ranger/help/starting.py b/ranger/help/starting.py
index 069d6a04..99cfc45e 100644
--- a/ranger/help/starting.py
+++ b/ranger/help/starting.py
@@ -95,6 +95,7 @@ Flags give you a way to modify the behaviour of the spawned process.
 	s	Silent mode.  Output will be discarded.
 	d	Detach the process.  (Run in background)
 	p	Redirect output to the pager
+	w	Wait for an enter-press when the process is done
 
 For example, "open with: p" will pipe the output of that process into
 the pager.
le='Blame the previous revision' href='/akkartik/mu/blame/055stream.subx?h=main&id=22fb844ba4edf14eb85245a35f42e721658c4f8e'>^
bfcc0f85 ^
33352536 ^
bfcc0f85 ^
33352536 ^
03c6f1d3 ^
33352536 ^
03c6f1d3 ^
33352536 ^
3ac95f6a ^

71eb22a5 ^
33352536 ^
03c6f1d3 ^
2a2a5b1e ^
33352536 ^
6070c23e ^
2a2a5b1e ^
6ecddbaa ^
2a2a5b1e ^
33352536 ^
03c6f1d3 ^


33352536 ^

7a583220 ^
33352536 ^

03c6f1d3 ^
f0705578 ^
71eb22a5 ^
7a583220 ^
33352536 ^

f0705578 ^
33352536 ^


f0705578 ^
33352536 ^
f0705578 ^

33352536 ^
7a583220 ^
33352536 ^

f0705578 ^
1639687b ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74