##// END OF EJS Templates
chgserver: add "setumask2" command which uses correct message frame...
Yuya Nishihara -
r40144:e5fbdc36 default
parent child Browse files
Show More
@@ -19,7 +19,8 b''
19 'setenv' command
19 'setenv' command
20 replace os.environ completely
20 replace os.environ completely
21
21
22 'setumask' command
22 'setumask' command (DEPRECATED)
23 'setumask2' command
23 set umask
24 set umask
24
25
25 'validate' command
26 'validate' command
@@ -452,8 +453,20 b' class chgcmdserver(commandserver.server)'
452 os.chdir(path)
453 os.chdir(path)
453
454
454 def setumask(self):
455 def setumask(self):
456 """Change umask (DEPRECATED)"""
457 # BUG: this does not follow the message frame structure, but kept for
458 # backward compatibility with old chg clients for some time
459 self._setumask(self._read(4))
460
461 def setumask2(self):
455 """Change umask"""
462 """Change umask"""
456 mask = struct.unpack('>I', self._read(4))[0]
463 data = self._readstr()
464 if len(data) != 4:
465 raise ValueError('invalid mask length in setumask2 request')
466 self._setumask(data)
467
468 def _setumask(self, data):
469 mask = struct.unpack('>I', data)[0]
457 _log('setumask %r\n' % mask)
470 _log('setumask %r\n' % mask)
458 os.umask(mask)
471 os.umask(mask)
459
472
@@ -488,7 +501,8 b' class chgcmdserver(commandserver.server)'
488 'chdir': chdir,
501 'chdir': chdir,
489 'runcommand': runcommand,
502 'runcommand': runcommand,
490 'setenv': setenv,
503 'setenv': setenv,
491 'setumask': setumask})
504 'setumask': setumask,
505 'setumask2': setumask2})
492
506
493 if util.safehasattr(procutil, 'setprocname'):
507 if util.safehasattr(procutil, 'setprocname'):
494 def setprocname(self):
508 def setprocname(self):
General Comments 0
You need to be logged in to leave comments. Login now