Ticket #4305: showCommandForUser.dpatch

File showCommandForUser.dpatch, 4.4 KB (added by igloo, 4 years ago)
Line 
11 patch for repository http://darcs.haskell.org/packages/process:
2
3Sun Sep 12 11:55:32 BST 2010  Ian Lynagh <igloo@earth.li>
4  * Define showCommandForUser
5
6New patches:
7
8[Define showCommandForUser
9Ian Lynagh <igloo@earth.li>**20100912105532] {
10hunk ./System/Process.hs 52
11 #endif
12         system,
13         rawSystem,
14+        showCommandForUser,
15 
16 #ifndef __HUGS__
17        -- * Process completion
18hunk ./System/Process.hs 495
19 rawSystem :: String -> [String] -> IO ExitCode
20 #ifdef __GLASGOW_HASKELL__
21 rawSystem cmd args = syncProcess "rawSystem" (proc cmd args)
22-
23 #elif !mingw32_HOST_OS
24 -- crude fallback implementation: could do much better than this under Unix
25hunk ./System/Process.hs 497
26-rawSystem cmd args = system (unwords (map translate (cmd:args)))
27-
28-translate :: String -> String
29-translate str = '\'' : foldr escape "'" str
30-  where        escape '\'' = showString "'\\''"
31-       escape c    = showChar c
32+rawSystem cmd args = system (showCommandForUser cmd args)
33 #else /* mingw32_HOST_OS &&  ! __GLASGOW_HASKELL__ */
34 # if __HUGS__
35hunk ./System/Process.hs 500
36-rawSystem cmd args = system (unwords (cmd : map translate args))
37+rawSystem cmd args = system (cmd ++ showCommandForUser "" args)
38 # else
39hunk ./System/Process.hs 502
40-rawSystem cmd args = system (unwords (map translate (cmd:args)))
41+rawSystem cmd args = system (showCommandForUser cmd args)
42+#endif
43 #endif
44 
45hunk ./System/Process.hs 506
46--- copied from System.Process (qv)
47 translate :: String -> String
48hunk ./System/Process.hs 507
49+#if mingw32_HOST_OS
50 translate str = '"' : snd (foldr escape (True,"\"") str)
51   where escape '"'  (b,     str) = (True,  '\\' : '"'  : str)
52         escape '\\' (True,  str) = (True,  '\\' : '\\' : str)
53hunk ./System/Process.hs 513
54         escape '\\' (False, str) = (False, '\\' : str)
55         escape c    (b,     str) = (False, c : str)
56+#else
57+translate str = '\'' : foldr escape "'" str
58+  where escape '\'' = showString "'\\''"
59+        escape c    = showChar c
60 #endif
61 
62hunk ./System/Process.hs 519
63+showCommandForUser :: FilePath -> [String] -> String
64+showCommandForUser cmd args = unwords (map translate (cmd : args))
65+
66 #ifndef __HUGS__
67 -- ----------------------------------------------------------------------------
68 -- terminateProcess
69}
70
71Context:
72
73[Whitespace only
74Ian Lynagh <igloo@earth.li>**20100912104516]
75[add a test for #4198
76Simon Marlow <marlowsd@gmail.com>**20100813151121
77 Ignore-this: aca2dab2209e68ac430a94e98756b52b
78]
79[Cope with an exit code of -1 (#4198)
80Simon Marlow <marlowsd@gmail.com>**20100813151038
81 Ignore-this: 6d12b19749b8a6f5d38c89aa9ace86d8
82]
83[Fix comment typo and whitespace
84Ian Lynagh <igloo@earth.li>**20100711102627
85 Ignore-this: b4bb0371a5511ff862d79dd8f8026ba8
86]
87[Correct documentation of readProcess
88Simon Hengel <simon.hengel@wiktory.org>**20100711075517
89 Ignore-this: 473457730146d2d93dd3ddbdae56f78e
90 
91  * The return type is not 'Either (ExitCode, String) String', it is just
92    'String'
93  * readProcess does not return stderr + stdout, it returns just stdout
94]
95[bump version to 1.0.1.3
96Ian Lynagh <igloo@earth.li>**20100519181550]
97[Fix #4074: disable the timer signal around fork()
98Simon Marlow <marlowsd@gmail.com>**20100518083617
99 Ignore-this: 3a3cb5ddb04715a499eccf523f6f56b4
100]
101[Allow filepath-1.2.*
102Simon Marlow <marlowsd@gmail.com>**20100505101104
103 Ignore-this: 4314b3bb5af924c3354ba85bace525ba
104]
105[Add comments re: #431
106Simon Marlow <marlowsd@gmail.com>**20091211100540
107 Ignore-this: 98ababbd89b873bdab7ccb398d28d4b9
108]
109[Fix the 3231 test
110Ian Lynagh <igloo@earth.li>**20091209195024]
111[Add aclocal.m4 to extra-source-files
112Ian Lynagh <igloo@earth.li>**20090921165620]
113[Bump version to 1.0.1.2
114Ian Lynagh <igloo@earth.li>**20090920141949]
115[Fix unportable use of sleep(1)
116Matthias Kilian <kili@outback.escape.de>**20090829093720
117 Ignore-this: c23892584741f1b5206952abd3e47177
118 `sleep 1s' is probably a GNUism; `sleep 1' should do the same in a
119 portable way.
120]
121[fix parallel test bugs
122Simon Marlow <marlowsd@gmail.com>**20090727125348
123 Ignore-this: 42b1fb60cb0dc9085483a9a0049c4167
124]
125[Use Unicode strings for the command and working dir on Windows
126Simon Marlow <marlowsd@gmail.com>**20090630091508
127 Ignore-this: 2bb455399a1d68d54aeeeeb0427f8636
128]
129[Fix some "warn-unused-do-bind" warnings where we want to ignore the value
130Ian Lynagh <igloo@earth.li>**20090710201717]
131[Remove unused imports
132Ian Lynagh <igloo@earth.li>**20090707115856]
133[TAG 2009-06-25
134Ian Lynagh <igloo@earth.li>**20090625160350]
135Patch bundle hash:
136b77fe6b37463d01de05f749c4f8d151c8d33243a