OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // |
| 5 // Script used by the file_lock_test.dart test. |
| 6 |
| 7 import "dart:io"; |
| 8 |
| 9 main(List<String> args) { |
| 10 File file = new File(args[0]); |
| 11 int start = null; |
| 12 int end = null; |
| 13 var mode = FileLock.EXCLUSIVE; |
| 14 if (args[1] == 'SHARED') { |
| 15 mode = FileLock.SHARED; |
| 16 } |
| 17 if (args[2] != 'null') { |
| 18 start = int.parse(args[2]); |
| 19 } |
| 20 if (args[3] != 'null') { |
| 21 end = int.parse(args[3]); |
| 22 } |
| 23 var raf = file.openSync(mode: WRITE); |
| 24 try { |
| 25 raf.lockSync(mode, start, end); |
| 26 print('LOCK SUCCEEDED'); |
| 27 } catch (e) { |
| 28 print('LOCK FAILED'); |
| 29 } finally { |
| 30 raf.closeSync(); |
| 31 } |
| 32 } |
OLD | NEW |